function [z]=PCA(data)
% Function PCA performs principal component analysis. 
% It defines the principal components for the given data.
% 
% Input
%   data    Data matrice, which should have at least three columns.
%
% Output
%   z       Matrice of eigenvectors which corresponding eigenvalues are biggest.
%
% Authors: Anu Niemi, Annemari Auvinen
data=load('ofs_top_5_tr_n_t.txt');
data = data(:,1:5);
[m n] = size(data);
if (n < 3)
    error('Data matrice should have at least three colums');
end
c=cov(data);
[v, d]=eig(c);
z = [v(:,n) v(:,n-1) v(:,n-2)];